﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using MyHospital.BLL;

namespace MyHospital.web
{
    public partial class UserAppraise : System.Web.UI.Page
    {
        Appraise1 appraise = new Appraise1();

        int grade = 0;

        [WebMethod]
        public static string getvalueajax(string a)
        {

            return a;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            /* if (IsPostBack)
             {
                 if (Request["Num"] != null)
                 {
                     int num = int.Parse(Request["Num"]);
                     grade = num;
                 }

             }*/
            /*grade = Request.Form["Num"];*/


            /* grade = Hidden.Value;*/

            if (Session["PatientID"] == null)
            {
                Response.Write("<script>alert('未登录，请先登录！');window.location.href='Login.aspx';</script>");
            }
            else
            {
                var iamge = appraise.Get_docimage((int)Session["PatientID"]);
                var name = appraise.Get_docname((int)Session["PatientID"]);
                var introduce = appraise.get_introduce((int)Session["PatientID"]);
                var department = appraise.get_department((int)Session["PatientID"]);
                var content = appraise.get_content((int)Session["PatientID"]);
                var time = appraise.get_time((int)Session["PatientID"]);
                Label2.Text = name;
                Label3.Text = department;
                Label4.Text = introduce;
                Image2.Src = iamge;
                if (content != null)
                {
                    Panel1.Visible = false;
                    Label1.Text = content;
                    Label5.Text = time;
                }
                // contentbox.Text = content;
            }
            //Session["PatientID"] = 1;
            /*if (Convert.ToInt32(Hidden.Value) !=0)
            {
                a = Hidden.Value;
                grade = Convert.ToInt32(a);
            }*/


        }

        protected void btn_click(object sender, EventArgs e)
        {
            Panel1.Visible = false;
            Label1.Text = "评价：" + contentbox.Text;
            Label5.Text = DateTime.Now.ToString();
            var doctorid = appraise.get_docid((int)Session["PatientID"]);
            var patid = (int)Session["PatientID"];
            string cont = contentbox.Text;
            string time = DateTime.Now.ToString();






            appraise.insert(doctorid, patid, grade, time, cont);
            /* Label1.BorderColor = System.Drawing.ColorTranslator.FromHtml("#ccc");*/
            // appraise.Get_docimage((int)Session["PatientID"]);

        }

        protected void Button1_Click(object sender, EventArgs e)
        {

        }

    }
}